# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=libtsm
pkgver=4.0.2
pkgrel=0
pkgdesc="Terminal-emulator State Machine"
url="https://github.com/Aetf/libtsm"
arch="all"
license="MIT AND BSD-2-Clause"
makedepends="cmake samurai"
checkdepends="check-dev"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/Aetf/libtsm/archive/refs/tags/v$pkgver.tar.gz"

build() {
	cmake -B build -G Ninja -Wno-dev \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_TESTING="$(want_check && echo ON || echo OFF)"
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
58eb955012fd154b7c165d799d0f80c9a71a504481e78471103fd299f2e73f3b7d89487387166895a9a5996165344335baa56f0550317caaa2eec6b0bad55e59  libtsm-4.0.2.tar.gz
"
